﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Aij1.Utils;
using Aij1.Model;

namespace Aij1.Cms
{
    public partial class ChangePassword : AdminPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           
        }

        protected void ASPxCallback1_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
        {
            if (txtConfirm.Text != txtNewPass.Text)
            {
                e.Result = "两个新密码不同!";
                return;
            }
            if (CommOp.MD5(txtOldPass.Text) !=((S_Employee) CurrentUser).Password)
            {
                e.Result = "原密码不符!";
                return;
            }

            ((S_Employee)CurrentUser).Password = CommOp.MD5(txtNewPass.Text);
            CurrentUser.Save();

            e.Result = "密码修改成功！";
        }
    }
}